<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>&#35746;&#21333;</title>
    <link rel="stylesheet" href="css/report.css" type="text/css">
    <link rel="stylesheet" href="css/menu.css" type="text/css">
    <link rel="stylesheet" href="css/daterangepicker.css" type="text/css">
    <script src="js/jquery-2.0.3.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/common.js"></script>
    <script src="js/bootstrap-select.js"></script>
    <script src="js/moment.js"></script>
    <script src="js/daterangepicker.js"></script>
    <script src="js/main.js"></script>
</head>
<script type="text/javascript">
    var pageNumber = 1;
    $(function () {
        $("#name").text('${userName}');
        showList(pageNumber);
    })
    function showList(pageNum){
        alert(111)
        var url='./orderList.love';
        var params=[];
        $.ajax({
            type: 'POST',
            url: url,
            dataType: 'json',
            data:params,
            success: function (data) {
                alert(data)
                if(data.isSuccess){
                    if (data.data.rows.length == 0) {
                        $("#prev-page").hide();
                        $("#next-page").hide();
                        $("#current-page").hide();
                        $("#size").text(data.data.total);
                        $("#all-page").text(0);
                        $("#th").hide();
                        var p = '<tr><td style="font-size: 16px;font-weight: bold">&#26410;&#26597;&#35810;&#21040;&#35746;&#21333;&#65281;</td></tr>';
                        $("#tbody").html(p);
                    } else {
                        if (pageNum == 1) {
                            $("#prev-page").hide();
                            $("#next-page").show();
                            $("#current-page").show();
                        }
                        $("#size").text(data.data.total);
                        $("#current-page").text("第 " + pageNum + " 页");
                        var all = parseInt(data.data.total);
                        if (parseInt(all % 8) == 0) {
                            $("#all-page").text(parseInt(all / 8));
                            if (parseInt(all / 8) == 1 || parseInt(all) == 0) {
                                $("#next-page").hide();
                            }
                        } else {
                            $("#all-page").text(parseInt(all / 8) + 1);
                            if (parseInt(all / 8) + 1 == 1) {
                                $("#next-page").hide();
                            }
                        }
                        if (pageNum == 1) {
                            $("#prev-page").hide();
                        }
                        var temp = '';
                        var p='<tr><th>&#19979;&#21333;&#26102;&#38388;</th><th>&#21333;&#21495;</th><th>&#21830;&#21697;</th><th>&#21830;&#21697;&#22270;&#29255;</th><th>&#25968;&#37327;</th><th>&#22791;&#27880;</th><th>&#23458;&#25143;&#22995;&#21517;</th><th>&#23458;&#25143;&#30005;&#35805;</th><th>&#25910;&#36135;&#22320;&#22336;</th><th>&#29289;&#27969;&#21333;&#21495;</th></tr>'
                        $("#thead").html(p);
                        $.each(data.data.rows, function (i, order) {
                            temp += '<tr name="order"><td>' + order.create_at + '</td><td>' + order.code + '</td><td>' + order.goods_name + '</td><td>' + order.goods_photo + '</td><td>' + order.quantity + '</td><td>' + order.memo + '</td><td>' + order.buyer_name + '</td><td>' + order.buyer_phone + '</td><td>' + order.buyer_address + '</td><td>' + order.delivery_code + '</td></tr>';
                        });
                        $("#tbody").html(temp);
                    }
                }
                else{
                    alert(data.error)
                }
            }
        });
    }

    function prevPage() {
        pageNumber--;
        showList(pageNumber);
        if (pageNumber == 1) {
            $("#prev-page").hide();
            $("#next-page").show();
        } else {
            $("#prev-page").show();
            $("#next-page").show();
        }
        $("#current-page").text("第 " + pageNumber + " 页");
    }
    function nextPage() {
        pageNumber++;
        showList(pageNumber);
        var all = parseInt($("#size").text());
        if (parseInt(all % 8) == 0 &amp;&amp; pageNumber == parseInt(all / 8)) {
            $("#next-page").hide();
            $("#prev-page").show();
        } else if (parseInt(all % 8) != 0 &amp;&amp; pageNumber == parseInt(all / 8) + 1) {
            $("#next-page").hide();
            $("#prev-page").show();
        } else if (parseInt(all % 8) != 0 &amp;&amp; pageNumber != parseInt(all / 8) + 1) {
            $("#next-page").show();
            $("#prev-page").show();
        }
        $("#current-page").text("第 " + pageNumber + " 页");
    }




    $("#saleGoodsDateRange").daterangepicker(defaults,
            function (start, end, label) {
                var pattern = 'YYYY-MM-DD';
                if(this.timePicker){
                    pattern = 'YYYY-MM-DD HH:mm'
                }
                if (this.singleDatePicker) {
                    $('#saleGoodsDateRange input').val(start.format(pattern));
                } else {
                    $('#saleGoodsDateRange input').val(start.format(pattern) + ' 至 ' + end.format(pattern));
                }
            });

    /**
     * 传图
     */
    function imgUpload(){
        $.ajaxFileUpload({
            url:imgUploadUrl,
            async:true,
            secureuri:false,
            fileElementId:"imgFile",
            dataType:"JSON",
            success:function(data){
                if(data.success=="false"){
                    $.messageExt.alert("系统提示",data.msg,"error");
                    return;
                }
                $("#img").attr("src",data.filePath);
                $("input[name='photo']").val(""+data.dbpath+"");
            }
        })
    }

    <div class="col-md-3 col-sm-12 col-xs-12">
            <div class="data-fileUpload-box">
            <input type="file" name="imgFile" id="imgFile" style="display: none">
            <div class="data-fileUpload-box-body" id="imgUpload">
            <div class="data-fileUpload-box-img">
            <img id="img" src="${resource(dir: 'saaserp', file: 'css/img/fileBackground.png', base: '..')}">
            </div>

            <div class="data-fileUpload-box-txt">
            <p>点击上传图片</p>
            </div>
            </div>
            </div>
            </div>



</script>
<body>
<ul id="menu">
    <li><a href="#">&#35746;&#21333;</a></li>
    <li><a href="#">&#25253;&#34920;</a></li>
    <li><a href="#">&#21830;&#21697;</a></li>
    <li><a href="#">&#20195;&#29702;</a></li>
    <li><a href="#">&#35268;&#26684;</a></li>
    <li><a href="#">&#28155;&#21152;&#35746;&#21333;</a></li>
    <li><a href="#">&#28155;&#21152;&#21830;&#21697;</a></li>
    <li><a href="#">&#28155;&#21152;&#20195;&#29702;</a></li>
    <li><a href="#">&#28155;&#21152;&#35268;&#26684;</a></li>


    <li style="float:right;text-align: center;color: darkgrey">&#27426;&#36814;&#22238;&#26469;&#65292;&#20146;&#29233;&#30340;<span id="name" style="font-weight: bold;color:antiquewhite"></span></li>
</ul>
<div id="container">

    <table class="zebra">
        <caption>&#35746;&#21333;&#21015;&#34920;</caption>
        <%--<div id="saleGoodsDateRange" class="date-range-box">
            <input type="text" id="saleGoodsRangeText"  class="form-control " name="daterange" />
        </div>--%>
        <thead id="thead">

        </thead>
        <tbody id="tbody">

        </tbody>
    </table>
    <>
</div>

</body>
</html>